﻿Imports Tohto.Base.DBUtility
Imports Tohto.Base.Entity
Imports Oracle.DataAccess.Client

Public Class KR0050P01B01
    Public Function Fetch_LIST(ByVal strLOGINID As String, _
                               ByVal strPostCd As String _
                                , ByVal strSeisanDt As String _
                                , ByRef errInfo As PLSQLErrorInfo) As DataSet

        Dim strCmdText As String
        strCmdText = "PG_KR0050.FETCH_LIST"

        Dim parameters(5) As OracleParameter

        'LOGINID
        Dim I_VC_LOGINID As New OracleParameter("I_VC_LOGINID", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_LOGINID.Value = strLOGINID

        '精算日
        Dim I_DT_SEISAN_DT As New OracleParameter("I_DT_SEISAN_DT", OracleDbType.Date, ParameterDirection.Input)
        If strSeisanDt = "" Then
            I_DT_SEISAN_DT.Value = DBNull.Value
        Else
            I_DT_SEISAN_DT.Value = strSeisanDt
        End If


        '部署CD
        Dim I_VC_POST_CD As New OracleParameter("I_VC_POST_CD", OracleDbType.Varchar2, ParameterDirection.Input)
        If strPostCd = "" Then
            I_VC_POST_CD.Value = DBNull.Value
        Else
            I_VC_POST_CD.Value = strPostCd
        End If



        Dim O_CU_SHIKIKIN_KAKUTEI_ICHIRAN As New OracleParameter("O_CU_SHIKIKIN_KAKUTEI_ICHIRAN", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_CU_ERR As New OracleParameter("O_CU_ERR", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_STATS As New OracleParameter("O_STATS", OracleDbType.Int32, ParameterDirection.ReturnValue)

        parameters(0) = I_VC_LOGINID
        parameters(1) = I_DT_SEISAN_DT
        parameters(2) = I_VC_POST_CD
        parameters(3) = O_CU_SHIKIKIN_KAKUTEI_ICHIRAN
        parameters(4) = O_CU_ERR
        parameters(5) = O_STATS

        Dim ds As DataSet = Nothing
        Dim tableNames(0) As String
        tableNames(0) = "KAKUTEI_ICHIRAN"

        ds = OracleHelp.FillTable(OracleHelp.ConnectionStringLocalTransaction,
                                           CommandType.StoredProcedure,
                                           strCmdText,
                                           errInfo,
                                           parameters,
                                           tableNames)

        Return ds
    End Function
End Class
